import request from '@/utils/request'

// 查询会员等级下拉树列表
export function listTreeMemberLevel() {
  return request({
    url: '/member/memberlevel/list/tree',
    method: 'get'
  })
}


// 查询会员等级列表
export function listMemberLevel(params) {
  return request({
    url: '/member/memberlevel/list',
    method: 'get',
    params: params
  })
}

// 新增或修改商品属性
export function addOrUpdateMemberLevel(data) {
  if (!data.attrId){
    return addMemberLevel(data);
  }else {
    return updateMemberLevel(data)
  }
}

// 新增会员等级
export function addMemberLevel(data) {
  return request({
    url: '/member/memberlevel/save',
    method: 'POST',
    data: data
  })
}


// 修改会员等级
export function updateMemberLevel(data) {
  return request({
    url: '/member/memberlevel/update',
    method: 'POST',
    data: data
  })
}

// 批量修改会员等级
export function updateMemberBatch(data) {
  return request({
    url: '/member/memberlevel/update/sort',
    method: 'POST',
    data: data
  })
}


// 查询会员等级
export function getMemberById(id) {
  return request({
    url: '/member/memberlevel/info/'+id,
    method: 'GET'
  })
}


// 批量删除会员等级
export function delMemberByIds(ids) {
  return request({
    url: '/member/memberlevel/delete',
    method: 'delete',
    data: ids
  })
}
